a = list(map(int, input().split()))
n = int(input())
k = int(input())

minpath = []
minn = n


def dfs(path, sum, start):
    global minn, minpath
    if sum == k:
        if len(path) < minn:
            minn = len(path)
            minpath = path
        return []
    if start >= n:
        return []
    dfs(path, sum, start + 1)
    dfs(path + [a[start]], sum + a[start], start + 1)


path = []
dfs(path, 0, 0)
print(minpath)
print(len(minpath))
